<?php
/**
* 短信模块 工具类
*
* 短信模块 工具类
* 以下use模块请不要互相伤害
*
* @author    xiecz <xiecz@yunys.com.cn>
* @copyright 2016 QuanZhouYunYiShang Inc.
*/
namespace App\Services\Tool\XCZ\SMS;
use App\Services\Tool\XCZ\SMS\CCPSDK;

class SMS{

    static function run($input){
        $rest = new CCPSDK('sandboxapp.cloopen.com', '8883', '2013-12-26');
        $rest->setAccount(env('accountSid'), env('accountToken'));
        $rest->setAppId(env('appId'));
        $random = $rest->random(4);
        $time = time();
        $datas = array("$random", "1"); //发送给用户的验证码 和 有效时间
        $result = $rest->sendTemplateSMS($input['phone'], $datas, env('tempId'));
        return ['state' => $result->statusCode, 'code' => $random];
    }

}
